<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <script src="./js/vue.js"></script>
    <title>自定义指令</title>
  </head>
  <body>
    <div id="root"><span v-big="num"></span><br /></div>
  </body>
  <script>
    Vue.config.productionTip = false; // 关闭使用开发版本提示
    new Vue({
      el: "#root",
      data: {
        num: 1,
      },
      directives: {
        // 自定义指令（函数式）
        // el: 指令所绑定的元素，可以用来直接操作 DOM
        // binding: 配置对象
        big(element, binding) {
          console.log(element, binding);
          element.innerText = binding.value * 10;
        },
      },
    });
  </script>
</html>
